<?php
include_once('../bootstrap.php');
$fecha = date('d-m-Y');
$emails = Doctrine::getTable('email')->findAll();
$csv = '';
foreach ($emails as $email) {
    $csv .= $email->value.'; ';
}
$csv = substr($csv, 0, -2);
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="emails.'.$fecha.'.csv"');
echo($csv);
?>